﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TasksModel
{
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://mp.tasks.com/2010/")]
    public class TaskAuthorList : TaskObservableCollection<TaskAuthor>
    {
        public TaskAuthorList Sort<TKey>(Func<TaskAuthor, TKey> keySelector)
        {
            IOrderedEnumerable<TaskAuthor> o = this.OrderBy(keySelector);
            int i = 0;
            SuspendChangedEvents();
            foreach (TaskAuthor s in o)
            {
                Move(IndexOf(s), i);
                i++;
            }
            ResumeChangedEvents();
            return this;
        }
    }
}